﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SharpObjects.Configuration;
using SharpObjects.Configuration.ConfigurationProviders;
using SharpObjects.Interfaces;

namespace SharpRuleEngineTest
{
    class CarInventoryItem : IXmlInitializable
    {
        public string Vid { get; set; }
        public string Make { get; set; }
        public string Model { get; set; }
        public int Year { get; set; }
        public string Color { get; set; }
        public double Price { get; set; }
        public bool Used { get; set; }

        #region IInitializable Members

        public void Initialize(System.Xml.XmlElement initializationElement)
        {
            IConfigurationReader init = new XmlConfigurationProvider(initializationElement);

            Vid = init.GetString("vid");
            Make = init.GetString("make");
            Model = init.GetString("model");
            Year = init.GetInteger("year");
            Color = init.GetString("color");
            Price = init.GetDouble("price");
            Used = init.GetBoolean("used");

            this.IsInitialized = true;
        }

        public bool IsInitialized { get; set; }

        #endregion
    }
}
